package
{
	import flash.utils.Proxy;
	import flash.utils.flash_proxy;
	import flash.net.SharedObject;
	
	use namespace flash_proxy;
	/**
	 * 
	 * @author daniele
	 * 
	 */
	[Bindable]
	public dynamic class StoredObject extends Proxy
	{
		private var _name:String;
		private var _object:SharedObject;
		/**
		 * 
		 * @param name
		 * 
		 */		
		public function StoredObject(name:String="_storedObject")
		{
			_name = name;
			_object = SharedObject.getLocal(name);
		}
		/**
		 * 
		 * @param name
		 * @param rest
		 * @return 
		 * 
		 */		
		flash_proxy override function getProperty(name:*):*
		{
			return _object.data[name];
		}
		/**
		 * 
		 * @param name
		 * @param value
		 * 
		 */		
		flash_proxy override function setProperty(name:*, value:*):void
		{
			_object.data[name] = value;
			_object.flush()
		}
	}
}